import { Component, OnInit } from '@angular/core';
import {Headers, Http} from "@angular/http";
import {Observable} from "rxjs/Observable";

@Component({
  selector: 'app-product',
  templateUrl: './product.component.html',
  styleUrls: ['./product.component.css']
})
export class ProductComponent implements OnInit {

  products:Observable<any>;

  constructor(private http:Http) {
  }
  ngOnInit() {
    let headers = new Headers();
    headers.append('tnapikey','6056905ce4f440d6a5b8179d80e5fd4d');
    this.http.get('/query/qapi/product/list.do',{headers:headers}).subscribe(data => {
      this.products = data.json();
      console.log(this.products.body.list);
    });

  }


}
